package day10;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Ques1867 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			Map<String,Integer> map = new HashMap<>();
			int index = 0;
			String str = "";
			while(!str.equals("endoftext")){
				str = scan.next().toLowerCase().replace(".", " ").replace("-", " ");
				if(!str.equals("endoftext")){
					if(!map.containsKey(str)){
						map.put(str, 1);
					}else{
						map.put(str, map.get(str)+1);											
					}
				}
			}
			List<String> list = new ArrayList<>();
			for(Entry<String,Integer> entry : map.entrySet()){
				System.out.println(entry.getKey() + "=====" + entry.getValue());
				if(entry.getValue() == n){
					list.add(entry.getKey());
				}
			}
			for(String s : list){
				System.out.println(s);
			}
		}
	}
}
